package com.example.test_map.tv;


import androidx.annotation.NonNull;

import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.platform.PlatformViewRegistry;

public class MyTextViewFlutterPlugin implements FlutterPlugin {

    //channel的名称，由于app中可能会有多个channel，这个名称需要在app内是唯一的。
    private static final String CHANNEL = "woshiku.flutter.io/launchApp";


    public void registerWith(FlutterEngine flutterEngine) {
        flutterEngine.getPlugins().add(this);
    }

    @Override
    public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
        PlatformViewRegistry registry = binding.getPlatformViewRegistry();

        // 消息解码器类型，我们没有特殊的要求，使用默认的即可。
        MyTextViewFactory factory = new MyTextViewFactory(binding.getBinaryMessenger());

        // 第一个字符串参数对应着一个类型的原生控件，在 Dart 中需要用相同的字符串创建 MapView。
        registry.registerViewFactory(CHANNEL, factory);
    }

    @Override
    public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {

    }
}